#include<iostream>
using namespace std;
int main(void) {
	int ans = 0;
	for(int i = 10000; i < 100000; i++) {
		int num = i;
		while(num) {
			int temp = num % 10;
			if(temp == 4) {
				ans++;
				break;
			}
			num /= 10;
		}
	}
	cout << "ans = " << ans << endl; 
	cout << "tickets = " << 100000 - 10000 - ans << endl;
	return 0;
} 
